home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / INTERNET / WI9609FT.ZIP / IMAGEEXA.JAV < prev    next >
Encoding:
Text File  |  1996-07-14  |  907 b   |  35 lines

  1. import java.applet.*;
  2. import java.awt.*;
  3.  
  4. public class imageExample extends Applet {
  5.    Image ims[];
  6.    MediaTracker mt;
  7.    boolean good;
  8.    
  9.    public void init() {
  10.      good = true;     
  11.      mt = new MediaTracker(this);
  12.      ims = new Image[10];
  13.  
  14.      /* The following loop loads images named im0.gif,  
  15.        im1.gif, etc. residing on the same server as the  
  16.        applet's document.*/
  17.  
  18.      for (int i = 0; i<= 9; i++) {
  19.        ims[i] = getImage(getDocumentBase(),"img"+i+".gif");
  20.        mt.addImage(ims[i],0);  /* places the image in the 
  21.                                   MediaTracker with an id 
  22.                                   number of 0 */
  23.      }
  24.      try {
  25.         mt.waitForID(0);
  26.        } 
  27.      catch (InterruptedException e) { 
  28.        System.out.println("Error in loading images: " + e);
  29.        }
  30.      if (mt.isErrorID(0)) 
  31.        good = false;
  32.    }
  33. }
  34.  
  35.